270

|

6 Applications and Methods in Biosignal Processing

plot(ts, x1);

xlabel('t / s');

ylabel('s(t)');

title('Rectified Phonokardiogram');

% Moving Average Filter

windowSize = 200;

% window sizeFensterbreite

b = (1/windowSize)*ones(1,windowSize);

% FIR ilter coeffizient

a = 1;

% IIR ilter coeffizient

x_av = filter(b,a,x1);

% apply filter

% Plot of absolute values after filtering

figure3 = figure;

plot(ts, x_av);

xlabel('t / s');

ylabel('s(t)');

title('Rectified Phonokardiogram after Filtering');

% Autocorrelation function AKF

x_c = xcorr(x_av,x_av);

tau = 1:length(x_c);

tau_1 = tau/8000;

% Plot of autocorrelation function

figure4 = figure;

plot(tau_1, x_c);

xlabel('\tau / s');

ylabel('AKF');

title('Autokorrelation');

% Calculation of peaks in the autocorrelation function

[s_pk, tau_pk] = findpeaks(x_c,tau_1);

[s_p1, pos] = max(s_pk)

tau_p1 = tau_pk(pos)

s_p2 = s_pk(pos+1)

tau_p2 = tau_pk(pos+1)

% Plot of peaks

figure5 = figure;

plot(tau_1, x_c);

hold on;

plot(tau_p1,s_p1,'rv','MarkerFaceColor','r');